package java44th.group.service.admin.dashboard;

import java44th.group.bean.po.MarketGoodsExample;
import java44th.group.bean.po.MarketGoodsProductExample;
import java44th.group.bean.po.MarketOrderExample;
import java44th.group.bean.po.MarketUserExample;
import java44th.group.mapper.MarketGoodsMapper;
import java44th.group.mapper.MarketGoodsProductMapper;
import java44th.group.mapper.MarketOrderMapper;
import java44th.group.mapper.MarketUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ProjectName project-second
 * @Descriptiom TODO
 * @Aurhor: 蔡文强
 * @Since: 2022/10/12 10:53
 */
@Service
public class DashboardServiceImpl implements DashboardService{

    @Autowired
    MarketGoodsMapper marketGoodsMapper;

    @Autowired
    MarketUserMapper marketUserMapper;

    @Autowired
    MarketGoodsProductMapper marketGoodsProductMapper;

    @Autowired
    MarketOrderMapper marketOrderMapper;

    @Override
    public int queryGoodsTotal() {
        MarketGoodsExample marketGoodsExample = new MarketGoodsExample();
        long total = marketGoodsMapper.countByExample(marketGoodsExample);
        int goodsTotal1 = (int) total;
        return goodsTotal1;
    }

    @Override
    public int queryUserTotal() {
        MarketUserExample marketUserExample = new MarketUserExample();
        long total = marketUserMapper.countByExample(marketUserExample);
        int userTotal = (int) total;
        return userTotal;
    }

    @Override
    public int queryProductTotal() {
        MarketGoodsProductExample marketGoodsProductExample = new MarketGoodsProductExample();
        long total = marketGoodsProductMapper.countByExample(marketGoodsProductExample);
        int productTotal = (int) total;
        return productTotal;
    }

    @Override
    public int queryOrderTotal() {
        MarketOrderExample marketOrderExample = new MarketOrderExample();
        long total = marketOrderMapper.countByExample(marketOrderExample);
        int orderTotal = (int) total;
        return orderTotal;
    }
}
